//package com.kmb.security.config;
//
//import org.springframework.context.annotation.Configuration;
//import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.http.SessionCreationPolicy;
//import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
//import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
//import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
//
//@Configuration
//@EnableResourceServer
//public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter {
//
////    @Override
////    public void configure(HttpSecurity http) throws Exception {
////        http.formLogin().and().exceptionHandling()
////                .and()
////                .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
////                .and()
////                .authorizeRequests()
////                .antMatchers("/").hasAuthority("SystemContent")
////                .antMatchers("/view/**").hasAuthority("SystemContentView")
////                .antMatchers("/insert/**").hasAuthority("SystemContentInsert")
////                .antMatchers("/update/**").hasAuthority("SystemContentUpdate")
////                .antMatchers("/delete/**").hasAuthority("SystemContentDelete");
////    }
//
//    @Override
//    public void configure(HttpSecurity http) throws Exception {
//        /**
//         * 将授权访问配置改为注解方式
//         * @see LoginController#info()
//         */
//        http.exceptionHandling()
//                .and()
//                // 不获取登录用户的 session
//                .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
////                .and()
////                .authorizeRequests()
////                .antMatchers("/oauth/**").permitAll();
//
////        http.exceptionHandling()
////                .and()
////                .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
////                .and()
////                .authorizeRequests()
////                // 授权访问
////                .antMatchers("/user/info").hasAuthority("USER")
////                .antMatchers("/user/logout").hasAuthority("USER");
//    }
//
//    @Override
//    public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
//        // 配置资源 ID
//        resources.resourceId("backend-resources");
//    }
//}
